function [ output ] = ApplyLinear( data )
%APPLYLINEAR Summary of this function goes here
%   Detailed explanation goes here

    output = zeros(size(data));
    sz = size(data, 1);
    
    for i=1:sz,
        y = data(i, :);
        n = length(y);
        
        x = 1:n;
        ci = ones(1, n);

        X = [ci' x'];
        yy = y';

        %X'*X *c = X' * y;
        c = X' * X \ X'*yy ;

        output(i,:) =  (X * c)';
    end
    
end

